<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('汽车信息修改')"/>
</head>
<body>
<form class="layui-form" action="" th:object="${CarInfo}">
    <div class="mainBox">
        <div class="main-container">
            <div class="main-container">

                <div class="layui-form-item layui-hide">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <input type="text" th:value="*{id}" name="id" lay-verify="title"
                               autocomplete="off" class="layui-input" hidden="hidden">
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label"></label>
                    <div class="layui-input-block">
                        <input th:value="*{userId}" type="text" name="userId" autocomplete="off" placeholder=""
                               class="layui-input" readonly>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">品牌</label>
                    <div class="layui-input-block">
                        <input th:value="*{carBrand}" type="text" name="carBrand" autocomplete="off" placeholder=""
                               class="layui-input"  readonly>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">型号</label>
                    <div class="layui-input-block">
                        <input th:value="*{carType}" type="text" name="carType" autocomplete="off" placeholder=""
                               class="layui-input"  readonly>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">车架号</label>
                    <div class="layui-input-block">
                        <input th:value="*{frameNumber}" type="text" name="frameNumber" autocomplete="off"
                               placeholder="" class="layui-input"  readonly>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">发动机号</label>
                    <div class="layui-input-block">
                        <input th:value="*{engineNumber}" type="text" name="engineNumber" autocomplete="off"
                               placeholder="" class="layui-input"  readonly>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">车牌号</label>
                    <div class="layui-input-block">
                        <input th:value="*{plateNumber}" type="text" name="plateNumber" autocomplete="off"
                               placeholder="" class="layui-input"  readonly>
                    </div>
                </div>




                <div class="layui-form-item">
                    <label class="layui-form-label">行驶证</label>
                    <div class="layui-input-block">
                        <input th:value="*{drivingLicenseUrl}" type="text" name="drivingLicenseUrl" autocomplete="off"
                               placeholder="" class="layui-input" readonly>
                    </div>
                </div>


                <div class="layui-form-item">
                    <label class="layui-form-label">审核状态</label>
                    <div class="layui-input-block">
                        <select name="carIdentifyStatus" th:value="*{carIdentifyStatus}" lay-verify="required" lay-search>
                            <option th:value="*{carIdentifyStatus}"></option>
                            <option value="0">资料待提交</option>
                            <option value="1">资料已提交</option>
                            <option value="2">认证通过</option>
                            <option value="3">认证失败</option>
                        </select>
                    </div>
                </div>


            </div>
        </div>
    </div>
    <div class="bottom">
        <div class="button-container">
            <button type="submit" class="layui-btn layui-btn-normal layui-btn-sm" lay-submit=""
                    lay-filter="carInfo-update">
                <i class="layui-icon layui-icon-ok"></i>
                提交
            </button>
            <button type="reset" class="layui-btn layui-btn-primary layui-btn-sm">
                <i class="layui-icon layui-icon-refresh"></i>
                重置
            </button>
        </div>
    </div>
</form>
<th:block th:include="include :: footer"/>
<script>
    layui.use(['form', 'laydate', 'jquery'], function () {
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = rootPath + "/CarInfoController";


        form.on('submit(carInfo-update)', function (data) {
            let loader = layer.load();
            $.ajax({
                url: MODULE_PATH + '/edit',
                data: data.field,
                dataType: 'json',
                contentType: 'application/x-www-form-urlencoded',
                type: 'post',
                success: function (result) {
                    if (result.code == 200) {
                        layer.msg(result.msg, {icon: 1, time: 1000}, function () {
                            parent.layer.close(parent.layer.getFrameIndex(window.name));//关闭当前页
                            parent.layui.table.reload("carInfo-table");
                            layer.close(loader);
                        });
                    } else {
                        layer.msg(result.msg, {icon: 2, time: 1000});
                        layer.close(loader);
                    }
                }
            })
            return false;
        });
    })
</script>
</body>
</html>